import axios from 'axios';

let base = '';

// 登录接口
export const requestLogin = params => { return axios.post(`${base}/api/login`, params).then(res => res.data); };
// 获取开关列表
export const getTenSwitchLists = params => { return axios.get(`${base}/api/getTenSwitchLists`, { params: params }); };
// 获取设备列表
export const getDeviceListPage = params => { return axios.get(`${base}/api/getDeviceLists`, { params: params }); };
// 获取设备控制
export const operateTenSwitch = params => { return axios.post(`${base}/api/operateTenSwitch`, params); };
// 修改通道名称
export const updateTenSwitchName = params => { return axios.post(`${base}/api/updateTenSwitchName`, params); };
// 获取通道状态
export const getTenSwitchStatus = params => { return axios.get(`${base}/api/getTenSwitchStatus`, { params: params }); };
// 获取设备
export const getDevicesIndex = params => { return axios.get(`${base}/api/getDevicesIndex`, { params: params }); };
// 新建设备
export const createDevice = params => { return axios.post(`${base}/api/createDevice`, params); };
// 编辑设备
export const editDevice = params => { return axios.post(`${base}/api/editDevice`, params); };
// 删除设备
export const deleteDevice = params => { return axios.post(`${base}/api/deleteDevice`, params); };
// 控制设备
export const pwmSwitch = params => { return axios.post(`${base}/api/pwmSwitch`, params); };
// 获取定时任务
export const getTimes = params => { return axios.get(`${base}/api/getTimes`, params); };
// 新建定时任务
export const createTime = params => { return axios.get(`${base}/api/createTime`, params); };
// 删除定时任务
export const deleteTime = params => { return axios.post(`${base}/api/deleteTime`, {id: params}); };
// 修改定时任务
export const updateTime = params => { return axios.post(`${base}/api/updateTime`, params); };
// 获取计时任务
export const getClocks = params => { return axios.get(`${base}/api/getClocks`, params); };
// 新建计时任务
export const createClock = params => { return axios.get(`${base}/api/createClock`, params); };
// 删除计时任务
export const deleteClock = params => { return axios.post(`${base}/api/deleteClock`, {id: params}); };
// 修改计时任务
export const updateClock = params => { return axios.post(`${base}/api/updateClock`, params); };
// 修改计时任务
export const clockSwitch = params => { return axios.post(`${base}/api/clockSwitch`, params); };
// 获取遥控控制
export const getRemotesIndex = params => { return axios.get(`${base}/api/getRemotesIndex`, { params: params }); };
// 新建遥控控制
export const createRemote = params => { return axios.post(`${base}/api/createRemote`, params); };
// 编辑遥控控制
export const editRemote = params => { return axios.post(`${base}/api/editRemote`, params); };
// 删除遥控控制
export const deleteRemote = params => { return axios.post(`${base}/api/deleteRemote`, params); };

// 获取开关控制
export const getSwitchIndex = params => { return axios.get(`${base}/api/getSwitchIndex`, { params: params }); };
// 新建开关控制
export const createSwitch = params => { return axios.post(`${base}/api/createSwitch`, params); };
// 编辑开关控制
export const editSwitch = params => { return axios.post(`${base}/api/editSwitch`, params); };
// 删除开关控制
export const deleteSwitch = params => { return axios.post(`${base}/api/deleteSwitch`, params); };
// 控制开关
export const controlSwitch = params => { return axios.post(`${base}/api/controlSwitch`, params); };

export const getUserListPage = params => { return axios.get(`${base}/user/listpage`, { params: params }); };

export const getUserList = params => { return axios.get(`${base}/user/list`, { params: params }); };

export const removeUser = params => { return axios.get(`${base}/user/remove`, { params: params }); };

export const batchRemoveUser = params => { return axios.get(`${base}/user/batchremove`, { params: params }); };

export const editUser = params => { return axios.get(`${base}/user/edit`, { params: params }); };

export const addUser = params => { return axios.get(`${base}/user/add`, { params: params }); };
